package com.w.picture.mode.enums;

import cn.hutool.core.util.ObjUtil;
import com.w.picture.mode.entity.Space;
import lombok.Getter;

/**
 * 邀请状态
 *
 * @author wzp
 * @since 2025/1/18
 */
@Getter
public enum InviteStatus {

    WAIT_CONFIRM("待确认", 0),
    CONFIRM("已确认", 1),
    REFUSE("已拒绝", 2);

    private final String text;

    private final int value;

    InviteStatus(String text, int value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     */
    public static InviteStatus getEnumByValue(Integer value) {
        if (ObjUtil.isEmpty(value)) {
            return null;
        }
        for (InviteStatus spaceTypeEnum : InviteStatus.values()) {
            if (spaceTypeEnum.value == value) {
                return spaceTypeEnum;
            }
        }
        return null;
    }
}


